package com.chongba.job;

import com.chongba.entity.ResponseMessage;
import com.chongba.feign.TaskServiceClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class JobService {

    @Autowired
    private TaskServiceClient taskServiceClient;

    @Scheduled(cron = "*/1 * * * * ?") //注意要将chongba_schedule_service中的@Scheduled注释
    public void refresh(){
        try {
            ResponseMessage refresh = taskServiceClient.refresh();
            log.info("refresh---,{}",refresh);
        } catch (Exception e) {
            log.error("refresh exception {}",e.getMessage());
        }
    }
}
